/*
 * HotPixelFinder.h
 *
 *  Created on: Jan 16, 2014
 *      Author: tbergmueller
 */

#ifndef HOTPIXELFINDER_H_
#define HOTPIXELFINDER_H_

#include <string>
#include <vector>
#include <opencv2/core/core.hpp>

class HotPixelFinder {
public:

	HotPixelFinder(std::string folder_2009_data, std::string folder_2013_data, int nrOfImages);
	virtual ~HotPixelFinder();

	void process();

	/**
	 * Available after the process() method was called
	 * @param oMean Output mean of hot pixel amplitude
	 * @param oMin Output minimum hot pixel amplitude
	 * @param oMax Output maximum hot pixel amplitude
	 */
	void readHotPixelAmplitudesTo(float oMean, float& oMin, float& oMax);

	#define MEDIAN_KERNEL_SIZE	5

private:
	int _nrOfFiles;
	std::string _folder2009;
	std::string _folder2013;

	/**
	 * Holds the amplitudes of hot pixels
	 */
	std::vector<float> _hotPixelAmplitudes;


	void calcHotPixelAmplitude(cv::Mat& locations, cv::Mat& values, int medianKernelSize=3);
	void calcHotPixelLocations(std::vector<cv::Mat>& inputs, std::string output_file_prefix, cv::Mat& o_defects, cv::Mat& o_defect_locations, cv::Mat& oMean);





};

#endif /* HOTPIXELFINDER_H_ */
